package com.xxjqr.rbac.entity.pojo;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.xxjqr.rbac.util.SnowIdUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author 丁昌江
 * @since 2021-02-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class TbRoleMenuRel extends Model<TbRoleMenuRel> {

    private static final long serialVersionUID = 1L;

    private Long id;

    private Long roleId;

    private Long menuId;

    private String roleName;

    private String roleCode;

    private String menuName;

    @TableLogic
    private Integer isDelete;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public static TbRoleMenuRel instance (Long roleId,Long menuId,String roleName,String roleCode,String menuName) {
        TbRoleMenuRel tbRoleMenuRel = new TbRoleMenuRel();
        tbRoleMenuRel.setId(SnowIdUtil.nextId());
        tbRoleMenuRel.setMenuId(menuId);
        tbRoleMenuRel.setRoleId(roleId);
        tbRoleMenuRel.setRoleCode(roleCode);
        tbRoleMenuRel.setRoleName(roleName);
        tbRoleMenuRel.setMenuName(menuName);
        tbRoleMenuRel.setIsDelete(0);
        return tbRoleMenuRel;
    }
}
